package com.zhuojy.equity.mall.admin.manager;

import java.util.List;

import cn.hutool.core.collection.CollUtil;
import com.zhuojy.equity.mall.admin.common.exception.Asserts;
import com.zhuojy.equity.mall.admin.dal.mapper.TRoleResourceRelationMapper;
import com.zhuojy.equity.mall.admin.manager.bo.LoginBO;
import lombok.RequiredArgsConstructor;

import org.springframework.stereotype.Component;

/**
 * 角色与资源关系表数据管理层
 */
@Component
@RequiredArgsConstructor
public class RoleResourceRelationManager {

	private final TRoleResourceRelationMapper roleResourceRelationMapper;

	public List<Long> queryResourceIdListByRoleIds(List<Long> roleIdList) {
		List<Long> resourceIdList = roleResourceRelationMapper.selectResourceIdListByRoleIds(roleIdList);
		if (CollUtil.isEmpty(resourceIdList)) {
			Asserts.fail("角色未分配资源！");
		}
		return resourceIdList;
	}
}
